<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/WEB-INF/page/inc/taglib.jsp" %>
<%
    String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>样例管理后台</title>
    <jsp:include page="inc/dwz.jsp"/>
    <!--  额外的引入  -->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/statics/swiper-4.4.1/dist/css/swiper.min.css">
    <script src="${pageContext.request.contextPath}/statics/swiper-4.4.1/dist/js/swiper.min.js"></script>
</head>
<body scroll="no">
<div id="layout">
    <div id="header">
        <!-- navMenu begin -->
        <div class="headerNav">
            <ul class="nav">
                <li style="color: white;">欢迎您（${sessionScope.exampleuser.employeeName}）！&nbsp;当前时间： <span id="time"></span></li>
                <li><a href="javascript:" style="color: black;">${userNo}</a></li>
                <li><a href="${pageContext.request.contextPath}/system/merchantEmployees/toChangeInfo" target="dialog" width="500" height="400" style="color: #fff;">帐号信息</a></li>
                <li><a href="${pageContext.request.contextPath}/system/merchantEmployees/toChangePassword" target="dialog" width="550" height="300" style="color: #fff;">修改密码</a></li>
                <li><a href="${pageContext.request.contextPath}/toLogout" target="dialog" width="300" height="200" mask="true" style="color: #fff;">退出</a></li>
            </ul>
            <ul class="themeList" id="themeList">
                <li theme="default">
                    <div class="selected">蓝色</div>
                </li>
                <li theme="green">
                    <div>绿色</div>
                </li>
                <li theme="purple">
                    <div>紫色</div>
                </li>
                <li theme="silver">
                    <div>银色</div>
                </li>
                <li theme="azure">
                    <div>天蓝</div>
                </li>
            </ul>
        </div>
        <!-- navMenu end -->

    </div>

    <div id="leftside">
        <div id="sidebar_s">
            <div class="collapse">
                <div class="toggleCollapse">
                    <div></div>
                </div>
            </div>
        </div>
        <div id="sidebar">
            <div class="toggleCollapse">
                <h2>主菜单</h2>
                <div>收缩</div>
            </div>

            <div class="accordion" fillSpace="sidebar">
                <!-- 迭代一级菜单 -->
                <%-- <c:forEach items="${sessionScope.examplemenu }" var="menu1">
                <c:if test="${ menu1.level==1}">
                    <div class="accordionHeader">
                        <h2>
                            <span>Folder</span>${menu1.name }
                            <a href="${pageContext.request.contextPath}/system/tpRole/list" target="navTab" rel="${pageContext.request.contextPath}/system/tpRole/list" fresh="true">/system/tpRole/list</a>
                        </h2>
                    </div>
                    <div class="accordionContent">
                        <ul class="tree treeFolder">
                            <!-- 迭代二级菜单 -->
                            <c:forEach items="${sessionScope.examplemenu }" var="menu2">
                                <c:if test="${ menu2.level==2 && menu1.id==menu2.pid}">
                                    <li><a href="${pageContext.request.contextPath}${menu2.url }" target="navTab" rel="${pageContext.request.contextPath}${menu2.url }" fresh="true">${menu2.name }</a></li>
                                </c:if>
                            </c:forEach>
                        </ul>
                    </div>
                </c:if>
            </c:forEach> --%>

                <%--<div class="accordionHeader">
                    <h2>
                        <span>Folder</span>系统管理
                    </h2>
                </div>
                <div class="accordionContent">
                    <ul class="tree treeFolder">
                        <li><a href="${pageContext.request.contextPath}/system/merchantEmployees/list" target="navTab"
                               rel="${pageContext.request.contextPath}/system/merchantEmployees/list"
                               fresh="true">员工管理</a></li>
                        <li><a href="${pageContext.request.contextPath}/system/role/list" target="navTab"
                               rel="${pageContext.request.contextPath}/system/role/list" fresh="true">角色管理</a></li>
                        <li><a href="${pageContext.request.contextPath}/system/permission/list" target="navTab"
                               rel="${pageContext.request.contextPath}/system/permission/list" fresh="true">权限管理</a>
                        </li>
                    </ul>
                </div>

                <div class="accordionHeader">
                    <h2 class="collapsable">
                        <span>Folder</span>招商管理
                    </h2>
                </div>

                <div class="accordionContent">
                    <ul class="tree treeFolder">
                        <li><a href="${pageContext.request.contextPath}/investment/customer/list" target="navTab"
                               rel="${pageContext.request.contextPath}/system/investment/list" fresh="true">招商信息管理</a>
                        </li>
                    </ul>
                </div>

                <div class="accordionHeader">
                    <h2>
                        <span>Folder</span>财务管理
                    </h2>
                </div>
                <div class="accordionContent">
                    <ul class="tree treeFolder">

                        <li><a href="${pageContext.request.contextPath}/orders/orders/list" target="navTab"
                               rel="${pageContext.request.contextPath}/orders/orders/list" fresh="true">财务管理</a></li>
                    </ul>
                </div>

                <div class="accordionHeader">
                    <h2>
                        <span>Folder</span>客户管理
                    </h2>
                </div>
                <div class="accordionContent">
                    <ul class="tree treeFolder">
                        <li><a href="${pageContext.request.contextPath}/customer/shop/list" target="navTab"
                               rel="${pageContext.request.contextPath}/customer/shop/list" fresh="true">客户信息</a></li>
                    </ul>
                </div>

                <div class="accordionHeader">
                    <h2>
                        <span>Folder</span>新客户管理
                    </h2>
                </div>
                <div class="accordionContent">
                    <ul class="tree treeFolder">
                        <li><a href="${pageContext.request.contextPath}//shop/shop/list" target="navTab"
                               rel="${pageContext.request.contextPath}/shop/shop/list" fresh="true">客户信息</a></li>
                    </ul>
                </div>

                <div class="accordionHeader">
                    <h2>
                        <span>Folder</span>统计分析
                    </h2>
                </div>
                <div class="accordionContent">
                    <ul class="tree treeFolder">
                        <li><a href="${pageContext.request.contextPath}/statistics/orders/list" target="navTab"
                               rel="${pageContext.request.contextPath}/statistics/orders/list" fresh="true">门店流水</a></li>
                        <li><a href="${pageContext.request.contextPath}/statistics/cardRecharge/list" target="navTab"
                               rel="${pageContext.request.contextPath}/statistics/cardRecharge/list" fresh="true">会员流水</a></li>
                    </ul>
                </div>--%>

            </div>
        </div>
    </div>
    <div id="container">
        <div id="navTab" class="tabsPage">
            <div class="tabsPageHeader">
                <div class="tabsPageHeaderContent">
                    <ul class="navTab-tab">
                        <li tabid="main" class="main"><a href="javascript:;"><span><span
                                class="home_icon">主页</span></span></a></li>
                    </ul>
                </div>
                <div class="tabsLeft">left</div>
                <div class="tabsRight">right</div>
                <div class="tabsMore">more</div>
            </div>
            <ul class="tabsMoreList">
                <li><a href="javascript:;">主页</a></li>
            </ul>
            <div class="navTab-panel tabsPageContent layoutBox">
                <div class="page unitBox">
                    <div layoutH="0">
                        <div class="row">
                        </div>
                        <div class="row">

                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>

</div>

<div id="footer">Copyright &copy; 2017 JKOSS</div>

</body>
<script type="text/javascript">
    //未读信息    js代码
    $('#show').click(function () {
        $('#msg').show();
    })
    $('#msg').mouseleave(function () {
        $(this).hide();
        $('#msg li').css('background', '#fff');
    })
    $('#msg li').mouseenter(function () {
        $(this).css('background', 'yellow').siblings().css('background', '#fff');
    })

    //未读信息     js代码结束
    //创建一个日期对象
    function show() {
        var d = new Date();
        //获取年份
        //var nian=d.getYear();//2016  //16
        var nian = d.getFullYear();//2016
        //获取月
        var yue = d.getMonth() + 1;//6   july 7月   0-11
        //获取星期几
        var xq = d.getDay();//5    0-6    0:星期天
        //获取几号
        var dd = d.getDate();//1    1-31
        //获取小时
        var h = d.getHours();// 16下午4点     24小时制
        //获取分钟
        var m = d.getMinutes();//31分
        //获取描述
        var s = d.getSeconds();//50秒
        document.getElementById("time").innerHTML = nian + "-" + twoNum(yue) + "-" + twoNum(dd) + " " + twoNum(h) + ":" + twoNum(m) + ":" + twoNum(s);
    }

    function twoNum(num){
        return num < 10 ? "0" + num : num;
    }

    setInterval("show()", 1000);

    //菜单迭代
    var menus = ${sessionScope.examplemenu};
    var path = "${pageContext.request.contextPath}";

    //父菜单
    function pmenu(menus) {
        //console.log(menus);
        var pmenuhtml = "";
        for (var i = 0; i < menus.length; i++) {
            pmenuhtml += "<div class='accordionHeader'>" + "	<h2>" + "		<span>Folder</span>" + menus[i].name
                //+"		<a href='${pageContext.request.contextPath}/system/tpRole/list' target='navTab' rel='${pageContext.request.contextPath}/system/tpRole/list' fresh='true'>/system/tpRole/list</a>"
                + "	</h2>" + "</div>"
            var submenu = menus[i].submenu;
            if (submenu) {
                pmenuhtml += "<div class='accordionContent'>"
                pmenuhtml += subMenu(menus[i]);
                pmenuhtml += "</div>"
            }

        }
        $(".accordion").html(pmenuhtml);
    }

    //子菜单
    function subMenu(menu) {
        var submenu = menu.submenu;
        //console.log(submenu);
        if (submenu) {
            var submenuhtmls = "";
            //控制树的li显示
            for (var i = 0; i < submenu.length; i++) {
                if (submenu[i].type != 2) {

                    var href = "";
                    var rel = "";
                    if (submenu[i].type == 1) {
                        href = "href='" + path + submenu[i].url + "' rel='" + path + submenu[i].url + "' target='navTab' fresh='true'";
                    }
                    submenuhtmls += "		<li><a " + href + "><i class='" + submenu[i].icon + "'></i>" + submenu[i].name + "</a>"
                    var subMenus = subMenu(submenu[i]);
                    if (subMenus) {
                        submenuhtmls += subMenus;
                    }
                    submenuhtmls += "</li>"
                }
            }
            //控制树的ul显示
            var submenuhtml = "";
            var submenuhtmlhead = "";
            var submenuhtmltail = "	</ul>";
            if (submenu[0].level == 2) {
                submenuhtmlhead = "	<ul class='tree'>";
            } else {
                submenuhtmlhead = "	<ul>";
            }
            //submenuhtml += submenuhtmls + "	</ul>"

            if (submenuhtmls) {
                submenuhtml = submenuhtmlhead + submenuhtmls + submenuhtmltail;
            }

            return submenuhtml;
        }
    }

    $(function () {
        //熏染菜单
        pmenu(menus);
    })

    var mySwiper = new Swiper('.swiper-container', {
        direction: 'horizontal', // 垂直切换选项
        loop: ${fn:length(requestScope.commonles)>4}, // 循环模式选项
        spaceBetween: 30,
        slidesPerView: 1,
        breakpoints: {
            1024: {
                width: 363,
            },
            1280: {
                width: 491,
            },
            1366: {
                width: 534,
            },
            1366: {
                width: 534,
            },
            1400: {
                width: 551,
            },
            1400: {
                width: 551,
            },
            1440: {
                width: 571,
            },
            1600: {
                width: 651,
            },
            1680: {
                width: 691,
            },
            1920: {
                width: 811,
            },
        },
        // 如果需要分页器
        pagination: {
            el: '.swiper-pagination',
            /* 分页器开关*/
            clickable: true,
        },

        /*   // 如果需要前进后退按钮
         navigation: {
         nextEl: '.swiper-button-next',
         prevEl: '.swiper-button-prev',
         },
         // 如果需要滚动条
         scrollbar: {
         el: '.swiper-scrollbar',
         },*/
    })

    function bulletinDetails(id) {
        $.pdialog.open("${pageContext.request.contextPath}/bulletin/bulletin/details?id=" + id, "bulletinDetails", "详情", {
            width: 1400,
            height: 800,
            mask: true,
            resizable: true,
            drawable: false
        });
    }

    function toNavTab(url, tabid, title) {
        navTab.openTab(tabid, url, {title: title, fresh: false, data: {}});
    }

    //双击打开详情
    function openDetails(obj) {
        var target = $(obj).attr("target");
        var href = $(obj).attr("href");
        var title = $(obj).attr("title");
        var tabid = href.substr(0, href.indexOf('?'));

        //判断用户是否拥有权限,没有权限,终止执行
        var urls = '${sessionScope.exampleurlsjson}';
        //  ${pageContext.request.contextPath}/system/role/toUpdate
        var auth = false;
        var urlsList = JSON.parse(urls);
        for (var i = 0; i < urlsList.length; i++) {
            if (urlsList[i] == tabid.substr(path.length)) {
                auth = true;
            }
        }
        if (!auth) {
            return;
        }
        if (target == 'dialog') {
            $.pdialog.open(href, tabid, title, {
                width: 820,
                height: 460,
                mask: true,
                resizable: true,
                drawable: false
            });
        } else if (target == 'navTab') {
            navTab.openTab(tabid, href, {title: title, fresh: false, data: {}});
        }
    }
</script>
</html>